/*
 * @Author: your name
 * @Date: 2021-06-17 15:23:24
 * @LastEditTime: 2021-07-13 19:54:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \usp-osm-frondend\src\api\user.js
 */
import { service } from '@/utils/request'

const api = {
  Login: '/auth/login',
  Logout: '/ad/logout',
  ForgetPsw: '/auth/forget-password',
  Register: '/auth/register',
  SendSms: '/admin/account/sms',
  // get my info
  UserInfo: '/base/userByToken',
  UserMenu: '/admin/account/menu/menu-list',
  getToken: '/ad/token',
  loginByLoginCode: '/base/loginByPasswrod'
}

export function login (data) {
  return service({
    url: api.Login,
    method: 'post',
    data
  })
}

export function getSmsCaptcha (data) {
  return service({
    url: api.SendSms,
    method: 'post',
    data
  })
}

export function getInfo () {
  return service({
    url: api.UserInfo,
    headers: { state: 'state' },
    method: 'post'
  })
}

export function logout () {
  return service({
    url: api.Logout,
    method: 'post'
  })
}

export function getMenu (data) {
  return service({
    url: api.UserMenu,
    method: 'get',
    headers: { state: 'state' },
    data
  })
}

export function getToken (data, state) {
  return service({
    url: api.getToken,
    method: 'post',
    data
  })
}

export function loginByLoginCode (data) {
  return service({
    url: api.loginByLoginCode,
    method: 'post',
    data
  })
}
